FSEEK

Section: MINTLIB LIBRARY FUNCTIONS (3)
Updated: 3 March 1993
Index Return to Main Contents
 

NAME

fseek, ftell, rewind - reposition a stream  

SYNOPSIS

#include <stdio.h>

fseek(FILE *stream, long offset, int mode);

long ftell(FILE *stream);

void rewind(FILE *stream);
 

DESCRIPTION

fseek sets the position of the next input or output operation on the stream. The parameter offset determines the new position according to the parameter mode:

  SEEK_SET (0): offset bytes from the start of the file
  SEEK_CUR (1): offset bytes further than the current
                position
  SEEK_END (2): offset bytes from the end of the file rewind is equivalent to fseek(stream, 0L, 0), except that no value is returned. ftell returns the offset of the current byte relative to the beginning of the file associated with the named stream. fseek and rewind undo any effects of ungetc. After fseek or rewind, the next operation on a file opened for update may be either input or output.  

RETURN VALUES

fseek returns 0 on success, -1 on failure. ftell returns a position >= 0 on success, -1 on failure.  

SEE ALSO

lseek(3), fopen(3), popen(3), ungetc(3)


 

Index

NAME
SYNOPSIS
DESCRIPTION
RETURN VALUES
SEE ALSO

This document was created by man2html, using the manual pages.
Time: 11:14:42 GMT, June 22, 2025